package com.framework.common.message;

public enum PacketType {

    HEARTBEAT("heartbeat"),
    PING("ping"),
    P2P("p2p"),
    OTHER(""),
    P2GROUP("p2group"),
    MANAGER("manager"),
    P2ROOM("p2room"),
    RTC("rtc"),
    ROOM_JOIN("room-join"),
    ROOM_QUIT("room-quit")
    ;



    PacketType(String value) {
        this.value = value;
    }

    public String getValue() {
        return value;
    }

    private String value;

    @Override
    public String toString(){
        return this.getValue().toString();
    }

    public static PacketType safeValueIgnoreCaseOf(String value) {
        for (PacketType type : PacketType.values()) {
            if (value.equalsIgnoreCase(type.getValue())) {
                return type;
            }
        }
        return  OTHER;
    }
}
